﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Web.Http;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using YlisChat;
using YlisChat.Controllers;
using YlisChat.Models;
using System.Threading;
using System.Threading.Tasks;

namespace YlisChat.Tests.Controllers
{
    [TestClass]
    public class ValuesControllerTest
    {
        [TestMethod]
        public async void Get()
        {
            // Arrange
            ChannelController controller = new ChannelController();

            // Act
            IHttpActionResult resultmsg = await controller.Get();
            CancellationToken token;
            HttpResponseMessage response = await resultmsg.ExecuteAsync(token);
            IEnumerable<ChannelModel> resultlist = new List<ChannelModel>();

            // Assert
            Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
            Assert.IsNotNull(resultlist);
            //FIXME:
            Assert.AreEqual(2, resultlist.Count());
            Assert.AreEqual("value1", resultlist.ElementAt(0));
            Assert.AreEqual("value2", resultlist.ElementAt(1));
        }

        [TestMethod]
        public void GetById()
        {
            // Arrange
            ChannelController controller = new ChannelController();

            // Act
            //string result = controller.Get(5);

            // Assert
            
            //Assert.AreEqual("value", result);
        }

        [TestMethod]
        public void Post()
        {
            // Arrange
            ChannelController controller = new ChannelController();

            // Act
            //controller.Post("value");

            // Assert
        }

        [TestMethod]
        public void Put()
        {
            // Arrange
            ChannelController controller = new ChannelController();

            // Act
            //controller.Put(5, "value");

            // Assert
        }

        [TestMethod]
        public void Delete()
        {
            // Arrange
            ChannelController controller = new ChannelController();

            // Act
            //controller.Delete(5);

            // Assert
        }
    }
}
